package com.filemanager.command;

import com.filemanager.exceptions.UnsupportedCommandException;

/**
 * User: vsinjavin
 * Date: 11/15/13
 */
public enum PossibleCommands {
    LS,
    TOUCH,
    MKDIR,
    CD,
    PWD;

   public static PossibleCommands convert(String command) throws UnsupportedCommandException{
       for(PossibleCommands possibleCommand :  PossibleCommands.values())
           if(possibleCommand.name().equals(command.toUpperCase()))
               return possibleCommand;
       throw new UnsupportedCommandException(String.format("Error!  Following command isn't supported: %s", command));
   }
}


